"""
路线管理后台
"""
from django.contrib import admin
from .models import RouteDistance, RoutePlan


@admin.register(RouteDistance)
class RouteDistanceAdmin(admin.ModelAdmin):
    list_display = ('from_attraction', 'to_attraction', 'distance', 'transport_cost', 'travel_time', 'created_at')
    list_filter = ('created_at',)
    search_fields = ('from_attraction__name', 'to_attraction__name')
    ordering = ('-created_at',)


@admin.register(RoutePlan)
class RoutePlanAdmin(admin.ModelAdmin):
    list_display = ('id', 'user_id', 'start_attraction', 'budget', 'total_cost', 'total_distance', 'created_at')
    list_filter = ('created_at', 'budget')
    search_fields = ('start_attraction__name',)
    readonly_fields = ('created_at',)
    ordering = ('-created_at',)

